package org.example.test.mapper;

import org.apache.ibatis.annotations.*;
import org.example.test.entity.Recruit;

import java.util.List;

@Mapper
public interface RecruitMapper {
    @Select("SELECT * from test.recruit where recruit_name like '%${recruitName}%'")
    List<Recruit> findAll(String recruitName);

    @Delete("delete  from test.recruit where recruit_id = #{recruitId}")
    int delete(Integer recruitId);

    @Insert("INSERT into test.recruit(recruit_id,recruit_name,recruit_sex,recruit_age,recruit_education,recruit_experience,recruit_application)values " +
            "(#{recruitId},#{recruitName},#{recruitSex},#{recruitAge},#{recruitEducation},#{recruitExperience},#{recruitApplication})")
    int add(Recruit recruit);
    @Update("update test.recruit set " +
            "recruit_id = #{recruitId}," +
            "recruit_name = #{recruitName}," +
            "recruit_sex = #{recruitSex}," +
            "recruit_age = #{recruitAge}," +
            "recruit_education = #{recruitEducation}," +
            "recruit_experience = #{recruitExperience}," +
            "recruit_application = #{recruitApplication} where recruit_id=#{recruitId}")

    int update(Recruit recruit);
}
